package spaska.data.readers;

import java.util.Iterator;
import java.util.List;
import java.util.Map;

import spaska.data.Dataset;
import spaska.data.Instance;
import spaska.data.UnknownValue;
import spaska.data.Value;

public class RemoveEmptyValidator implements Validator {

	@Override
	public void setParameters(Map<String, String> parameters) {
		// 
	}

	@Override
	public boolean validate(Dataset dataset) {
		List<Instance> is = dataset.getElements();
		for (Iterator<Instance> it = is.iterator(); it.hasNext();) {
			Instance i = it.next();
			for (Value v : i) {
				if (v instanceof UnknownValue) {
					it.remove();
					break;
				}
			}
		}
		return true;
	}

}
